//
//  BookingData.m
//  StraightTrain
//
//  Created by mk on 15/12/2.
//  Copyright © 2015年 mk. All rights reserved.
//

#import "BookingData.h"
#import "PatienUserData.h"

@implementation BookingInfoData


-(id)init
{
    if (self = [super init])
    {
        self.urlPath = @"";
        self.strDataKey = requestDataKey;
    }
    return self;
}

-(void)parseData:(id)dataObj
{
    [super parseData:dataObj];
    
    if ([dataObj isKindOfClass:[NSDictionary class]])
    {
        NSString * strObg = [NSString stringWithFormat:@"%@",NullObjToString(dataObj[@"age"])];
        self.booking_age = (strObg?strObg:@"");
        
        strObg = [NSString stringWithFormat:@"%@",NullObjToString(dataObj[@"ageMonth"])];
        self.booking_ageMonth = (strObg?strObg:@"");
        
        strObg = [NSString stringWithFormat:@"%@",NullObjToString(dataObj[@"dataCreate"])];
        self.booking_dataCreate = (strObg?strObg:@"");
        
        strObg = [NSString stringWithFormat:@"%@",NullObjToString(dataObj[@"dateUpdated"])];
        self.booking_dateUpdated = (strObg?strObg:@"");
        
        strObg = [NSString stringWithFormat:@"%@",NullObjToString(dataObj[@"diseaseDetail"])];
        self.booking_diseaseDetail = (strObg?strObg:@"");
        
        strObg = [NSString stringWithFormat:@"%@",NullObjToString(dataObj[@"diseaseName"])];
        self.booking_diseaseName = (strObg?strObg:@"");
        
        strObg = [NSString stringWithFormat:@"%@",NullObjToString(dataObj[@"id"])];
        self.booking_id = (strObg?strObg:@"");
        
        strObg = [NSString stringWithFormat:@"%@",NullObjToString(dataObj[@"isDepositPaid"])];
        self.booking_isDepositPaid = (strObg?strObg:@"");
        
        strObg = [NSString stringWithFormat:@"%@",NullObjToString(dataObj[@"isDepositPaidStatus"])];
        self.booking_isDepositPaidStatus = (strObg?strObg:@"");
        
        strObg = [NSString stringWithFormat:@"%@",NullObjToString(dataObj[@"name"])];
        self.booking_name = (strObg?strObg:@"");
        
        strObg = [NSString stringWithFormat:@"%@",NullObjToString(dataObj[@"patientId"])];
        self.booking_patientId = (strObg?strObg:@"");
        
        strObg = [NSString stringWithFormat:@"%@",NullObjToString(dataObj[@"refNo"])];
        self.booking_refNo =(strObg?strObg:@"");
        
        strObg = [NSString stringWithFormat:@"%@",NullObjToString(dataObj[@"status"])];
        self.booking_status = (strObg?strObg:@"");
        
        strObg = [NSString stringWithFormat:@"%@",NullObjToString(dataObj[@"statusCode"])];
        self.booking_statusCode = (strObg?strObg:@"");
        
        strObg = [NSString stringWithFormat:@"%@",NullObjToString(dataObj[@"travelType"])];
        self.booking_travelType = (strObg?strObg:@"");

        //收到的预约详情
        strObg = [NSString stringWithFormat:@"%@",NullObjToString(dataObj[@"creatorId"])];
        self.booking_creatorId = (strObg?strObg:@"");
        
        strObg = [NSString stringWithFormat:@"%@",NullObjToString(dataObj[@"dateStart"])];
        strObg = (strObg.length>0?strObg:[NSString stringWithFormat:@"%@",NullObjToString(dataObj[@"date_start"])]);
        self.booking_dateStart = (strObg?strObg:@"");
        
        strObg = [NSString stringWithFormat:@"%@",NullObjToString(dataObj[@"dateEnd"])];
        strObg = (strObg.length>0?strObg:[NSString stringWithFormat:@"%@",NullObjToString(dataObj[@"date_end"])]);
        self.booking_dateEnd = (strObg?strObg:@"");
        
        strObg = [NSString stringWithFormat:@"%@",NullObjToString(dataObj[@"detail"])];
        self.booking_detail = (strObg?strObg:@"");
        
        strObg = [NSString stringWithFormat:@"%@",NullObjToString(dataObj[@"apptDate"])];
        self.booking_apptDate =(strObg?strObg:@"");
        
        strObg = [NSString stringWithFormat:@"%@",NullObjToString(dataObj[@"dateConfirm"])];
        self.booking_dateConfirm = (strObg?strObg:@"");
        
        strObg = [NSString stringWithFormat:@"%@",NullObjToString(dataObj[@"remark"])];
        self.booking_remark = (strObg?strObg:@"");
        
        strObg = [NSString stringWithFormat:@"%@",NullObjToString(dataObj[@"dateNow"])];
        self.booking_dateNow = (strObg?strObg:@"");
        
    }
}

@end


@implementation BookingListData

-(id)init
{
    if (self = [super init])
    {
        self.urlPath = @"";
        self.strDataKey = requestDataKey;
    }
    return self;
}

-(void)parseData:(id)dataObj
{
    [super parseData:dataObj];
    
    if ([dataObj isKindOfClass:[NSArray class]])
    {
        for (int i = 0; i < [dataObj count]; i++) {
            NSDictionary *dicRec = [dataObj objectAtIndex:i];
            BookingInfoData *recData = [[BookingInfoData alloc] init];
            [recData parseData:dicRec];
            [self.dataArray addObject:recData];
        }
    }
}


@end





